export default {
	methods: {
		//通过保养滤芯编号获取保养信息
		async GetMaintainPartInfoByPartNum() {
			let result =await this.workordercompleteservice.GetMaintainPartInfoByPartNum(this.UserInfo.mobile,
				this.PartsNum, this.woid, this.UserInfo.RetId);
			if (result && result.RetBool) {
				if (result.RetObject) {
					return JSON.parse(result.RetObject);
				}
			} else {
				console.log(result.RetMsg);
				throw result.RetMsg
			}
			return null;
		},
		//获取保养信息
		GetMaintainPartInfo() {
			this.GetMaintainPartInfoByPartNum().then((succ)=>{
				this.maintainInfo = succ[0];
				this.maintainInfo.Img = this.getImage(this.maintainInfo.Img);
				uni.hideLoading();
			},(err)=>{
				console.log(err)
				uni.showToast({
					title:err,
					icon:'none'
				})
				uni.hideLoading();
			});
			
		},
		getImageBase64(itempic) {
			let srcbase64 = `data:image/${itempic.FileType.replace('.','')};base64,${itempic.ImageContent}`;
			return srcbase64;
		},
		getImage(image) {
			return (image != null && image != 'null' && image != '') ?
				"data:image/jpeg;base64," + image : "";
		},
	},
}
